package b2.widget.fort
{
	import b2.config.*;
	import b2.net.*;
	import b2.widget.tab.*;

	public class CampInfoPane extends TabController
	{
		public var campDetailTab:CampDetailTab;
		private var matchDetailTab:MatchDetailTab;
		private var fortressDialog:FortressDialog;
		
		public function CampInfoPane(fortressDialog:FortressDialog)
		{
			super();
			this.fortressDialog = fortressDialog;
			campDetailTab = new CampDetailTab(fortressDialog);
			matchDetailTab = new MatchDetailTab(fortressDialog);
			setTabTitlePos(10, 0);
			setTabPagePos(0, 15);
			refresh();
		}
		
		public function refresh():void
		{
			var campIndex:int = fortressDialog.currentSelectedCampItem.campIndex;
			var campConfig:CampConfig = Config.campConfigs[campIndex];
			var CampInfoTitle:Class = ResourceHelper.getInstance().getClassByName("ButtonBgr6");
			var HighlightTitleBgr:Class = ResourceHelper.getInstance().getClassByName("ButtonBgr4");
			//比赛战役
			if (campConfig.type == 2)
			{
				if (!this.contains(matchDetailTab))
				{
					this.removeAllTabs();
					addTab(CampInfoTitle, matchDetailTab.tabName, matchDetailTab, HighlightTitleBgr);
				}
				matchDetailTab.refresh();
			}
			else
			{
				if (!this.contains(campDetailTab))
				{
					this.removeAllTabs();
					addTab(CampInfoTitle, campDetailTab.tabName, campDetailTab, HighlightTitleBgr);
				}
				campDetailTab.refresh();
			}	
		}
		
	}
}